package cn.iocoder.yudao.module.signature.service.signinfo;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.signature.controller.app.signinfo.vo.ApplicationSignInfoPageReqVO;
import cn.iocoder.yudao.module.signature.controller.app.signinfo.vo.ApplicationSignInfoSaveReqVO;
import cn.iocoder.yudao.module.signature.dal.dataobject.device.AppleDeviceDO;
import cn.iocoder.yudao.module.signature.dal.dataobject.signinfo.ApplicationSignInfoDO;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.util.List;

/**
 * 应用签名记录 Service 接口
 *
 * @author base
 */
public interface ApplicationSignInfoService {

    /**
     * 创建应用签名记录
     *
     * @param createReqVO 创建信息
     * @return 编号
     */
    Long createApplicationSignInfo(@Valid ApplicationSignInfoSaveReqVO createReqVO) throws  Exception;


    Integer checkSignComplete(String url) throws Exception;

    /**
     * 卡密签名
     */
    ApplicationSignInfoDO signCard(@Valid ApplicationSignInfoSaveReqVO createReqVO) throws Exception;


    /**
     * 更新应用签名记录
     *
     * @param updateReqVO 更新信息
     */
    void updateApplicationSignInfo(@Valid ApplicationSignInfoSaveReqVO updateReqVO);

    /**
     * 删除应用签名记录
     *
     * @param ids 编号
     */
    void deleteApplicationSignInfo(List<Long> ids, Long userId);

    /**
     * 获得应用签名记录
     *
     * @param id 编号
     * @return 应用签名记录
     */
    ApplicationSignInfoDO getApplicationSignInfo(Long id);

    /**
     * 获得应用签名记录分页
     *
     * @param pageReqVO 分页查询
     * @return 应用签名记录分页
     */
    PageResult<ApplicationSignInfoDO> getApplicationSignInfoPage(ApplicationSignInfoPageReqVO pageReqVO);


    void excuteSignTask() throws Exception;

    void excuteSignTaskTest(Long id) throws Exception;

    /**
     * 签名
     * @param signInfoDO
     * @throws Exception
     */
    void doSign(ApplicationSignInfoDO signInfoDO,  AppleDeviceDO deviceDO );

    /**
     * 更新签名状态
     * @param signInfoDO
     */
    void upApplicationSignInfoNow(ApplicationSignInfoDO signInfoDO);

    /**
     * 插入签名记录
     * @param signInfoDO
     */
    void insertApplicationSignInfoNow(ApplicationSignInfoDO signInfoDO);

    /**
     * 锁定时间检查
     * @param id
     * @return
     */
    CommonResult lockTimeCheck(Long id);

    /**
     * 测试直接签名用
     * @param file
     * @return
     * @throws Exception
     */
     String testPackaging(MultipartFile file) throws Exception;


    List<ApplicationSignInfoDO> listRecentData(Long userId);

}